{% extends "base.html" %}
{% load markup %}

{% block title %}Welcome!{% endblock %}

{% block head %}
  <link rel="alternate" type="application/atom+xml" href="{% url news-feed %}/{{ user.username }}" />
{% endblock %}

{% block header %}{% endblock %}

{% block primary-content %}
<span class="breadcrumbs"><a href="{% url index %}" title="Home">Home</a> &raquo; Your News Feed</span>
<h2>Welcome {{ user }}</h2>
<div id="page-controls">
<h3>This is your news feed for:</h3>
<address>{{ user.get_profile.address }}</address>
<form id="address-search" class="clearfix">
	<label>Search a different Philadelphia address</label>
	<input type="text" class="search-input" name="address"/>
	<input type="submit" class="button" value="Search"/>
</form>
</div>
<div id="news-feed">
	<ul id="feed-filters">
    <li><a {% ifequal current "related" %}class="current" {% endifequal %}href="{% url index %}">News related to your reps</a></li>
    <li><a {% ifequal current "reports" %}class="current" {% endifequal %}href="{% url index %}?r=1">Related reports</a></li>
    <li><a {% ifequal current "posts" %}class="current" {% endifequal %}href="{% url index %}?p=1">Related blog posts</a></li>
    <li><a {% ifequal current "all" %}class="current" {% endifequal %}href="{% url index %}?a=1">All news</a></li>
	</ul>
	{% for item in news %}
	<div class="{% if item.is_report %}feed-report{% else %}feed-blog-post{% endif %}">
		<h3><a href="{% if item.is_report %}{% url report item.id %}{% else %}{% url blog_post item.id %}{% endif %}">{{ item.title }}</a></h3>
		<small class="date-posted">Posted {{ item.pub_date|date }}</small>
		{% if item.is_report %}
			{{ item.synopsis|markdown|truncatewords_html:"50" }}
		{% else %}
			{{ item.body|markdown|truncatewords_html:"50" }}
		{% endif %}
		<!--<p class="read-more"><a href="">Read more &raquo;</a></p>-->
	</div>
	{% endfor %}
</div>
{% endblock %}

